using System;
using System.Data.Entity.ModelConfiguration;
using System.Data.Common;
using System.Data.Entity;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using DomainLayer.Data.Entities;

namespace Infrastructure.Data.Mapping
{
	public class WarehouseMap : EntityTypeConfiguration<Warehouse>
	{
		public WarehouseMap()
		{
			// Primary Key
			this.HasKey(t => t.WarehouseId);

			// Properties
			this.Property(t => t.WarehouseId)
				.IsRequired()
				.HasMaxLength(20);
				
			this.Property(t => t.WarehouseName)
				.IsRequired()
				.HasMaxLength(40);
				
			this.Property(t => t.DistrictId)
				.IsRequired()
				.HasMaxLength(20);
				
			this.Property(t => t.Address)
				.HasMaxLength(50);
				
			this.Property(t => t.Postalcode)
				.HasMaxLength(10);
				
			this.Property(t => t.Manager)
				.HasMaxLength(20);
				
			this.Property(t => t.Phone)
				.HasMaxLength(20);
				
			this.Property(t => t.Fax)
				.HasMaxLength(50);
				
			this.Property(t => t.Email)
				.HasMaxLength(50);
				
			this.Property(t => t.CreateBy)
				.IsRequired()
				.HasMaxLength(40);
				
			this.Property(t => t.UpdateBy)
				.IsRequired()
				.HasMaxLength(40);
				
			// Table & Column Mappings
			this.ToTable("Warehouse");
			this.Property(t => t.WarehouseId).HasColumnName("WarehouseId");
			this.Property(t => t.WarehouseName).HasColumnName("WarehouseName");
			this.Property(t => t.DistrictId).HasColumnName("DistrictId");
			this.Property(t => t.Address).HasColumnName("Address");
			this.Property(t => t.Postalcode).HasColumnName("Postalcode");
			this.Property(t => t.Manager).HasColumnName("Manager");
			this.Property(t => t.Phone).HasColumnName("Phone");
			this.Property(t => t.Fax).HasColumnName("Fax");
			this.Property(t => t.Email).HasColumnName("Email");
			this.Property(t => t.IsForOrder).HasColumnName("IsForOrder");
			this.Property(t => t.IsMain).HasColumnName("IsMain");
			this.Property(t => t.Enable).HasColumnName("Enable");
			this.Property(t => t.CreateBy).HasColumnName("CreateBy");
			this.Property(t => t.CreateTime).HasColumnName("CreateTime");
			this.Property(t => t.UpdateBy).HasColumnName("UpdateBy");
			this.Property(t => t.UpdateTime).HasColumnName("UpdateTime");
			this.Property(t => t.HouseType).HasColumnName("HouseType");
			this.Property(t => t.IsAllowQuality).HasColumnName("IsAllowQuality");
			this.Property(t => t.WarehouseType).HasColumnName("WarehouseType");
			this.Property(t => t.ForbidLoginStart).HasColumnName("ForbidLoginStart");
			this.Property(t => t.ForbidLoginEnd).HasColumnName("ForbidLoginEnd");
			this.Property(t => t.RedeployType).HasColumnName("RedeployType");
			this.Property(t => t.SourceId).HasColumnName("SourceId");
		}
	}
}

